import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'DataList.dart';

class myCard extends StatelessWidget {
  // const myCard({
  //   super.key,
  // });

  DataList data;
  Function onTap;
  myCard(this.data, this.onTap);

  @override
  Widget build(BuildContext context) {
    return Card(
        color: Colors.grey[900],
        margin: EdgeInsets.fromLTRB(0, 0, 0, 10),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.stretch,
          children: [
            Text(
              data.key,
              style: TextStyle(
                color: Colors.grey[600],
                fontSize: 15.0,
              ),
            ),
            SizedBox(height: 10),
            Row(
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              children: [
                  Text(
                    data.value,
                    style: TextStyle(
                      color: Colors.amber,
                      fontWeight: FontWeight.bold,
                      fontSize: 20.0,
                    ),
                  ),
                  TextButton.icon(
                      onPressed: () {
                        onTap();
                      },
                      icon: Icon(
                        Icons.delete,
                        color: Colors.grey[600],
                      ),
                      label: Text(
                        "删除",
                        style: TextStyle(
                          color: Colors.grey[600],
                          fontSize: 15.0,
                        ),
                      )
                  ),
              ],
            ),
            SizedBox(height: 20),
          ],
        )
    );
  }
}